Skip to content

Add OSV-scanner PR gate + Dependabot remediation SLA, fix stale frontend lockfile - #671

Merged
Topmatrixmor2014 merged 3 commits into
FinChippay:mainfrom
Theophilus131:feat/dependency-security
Aug 21, 2026
Merged

Add OSV-scanner PR gate + Dependabot remediation SLA, fix stale frontend lockfile#671
Topmatrixmor2014 merged 3 commits into
FinChippay:mainfrom
Theophilus131:feat/dependency-security

Conversation

@Theophilus131

Copy link
Copy Markdown

Summary

close #646

No PR-time dependency vulnerability gate exists today — security-audit.yml (npm audit / cargo audit) and sbom-scan.yml (Grype) both only run on a weekly schedule. Meanwhile frontend/package-lock.json had drifted from frontend/package.json badly enough that npm ci was already broken on main (see commit 1). This PR:

  1. Fixes the lockfile drift.
  2. Adds an OSV-Scanner job that runs on every PR and fails on High/Critical findings across every real lockfile in the repo.
  3. Adds/refreshes .github/dependabot.yml with grouped PRs per ecosystem and a documented remediation SLA.
  4. Documents the triage process in docs/vulnerability-management.md.

Commit 1 — fix(frontend): resolve stale package-lock.json drift

Files changed: frontend/package.json (+2/-2 lines), frontend/package-lock.json (regenerated, 4245 insertions / 4085 deletions)

Two concrete bugs, not just staleness:

  • frontend/package.json line 24: "@finchippay/sdk": "*" had no matching entry anywhere in package-lock.json — npm was silently not locking it at all, so OSV-Scanner/Dependabot couldn't see it against the advisory database. Changed to "@finchippay/sdk": "file:../sdk" (its real path in this monorepo) so it resolves and appears in the lockfile.
  • frontend/package.json line 83: "postcss": "^8" as a direct devDependency, while package.json#overrides separately pinned postcss to 8.5.26. npm forbids overriding a direct dependency this way (EOVERRIDE) — this was already breaking npm ci on main, verified locally: npm error Override for postcss@^8 conflicts with direct dependency. Fixed by pinning the direct dependency to 8.5.26 to match the override's intent.
  • frontend/package-lock.json regenerated in full from the corrected package.json (lockfileVersion 3, 1204 resolved packages).

Verified: confirmed npm ci fails on the original files with the exact EOVERRIDE error above; confirmed the regenerated lockfile installs cleanly for the @finchippay/sdk and postcss entries specifically. Backend's backend/pnpm-lock.yaml was checked too — pnpm install --frozen-lockfile passes clean, no drift there, no changes needed.

Known follow-up (not fixed here, out of scope): regenerating the lockfile surfaced a real peer-dependency conflict — next@^16.3.0 vs. @storybook/experimental-nextjs-vite@8.6.18's peer range (^14.1.0 || ^15.0.0). This doesn't block the OSV-Scanner gate (it reads the lockfile directly, no install needed), but a plain npm ci in frontend/ needs --legacy-peer-deps until Storybook's Next.js addon is upgraded or Next is pinned back — this is a version-compatibility decision outside this issue's scope, tracked in docs/vulnerability-management.md and should be filed as a separate follow-up issue.

Cargo.lock was not regenerated — no cargo/rustup toolchain was available to verify it in this environment, and the issue only calls out frontend/package-lock.json for drift resolution. It's included in the new OSV-Scanner job's scan list regardless.


Commit 2 — ci(security): add OSV-Scanner PR gate and Dependabot config

.github/workflows/osv-scanner.yml (new, 88 lines)

  • Triggers on pull_request (→ main), push (→ main), and workflow_dispatch — this is the new PR-time gate; every other security workflow in the repo (security-audit.yml, sbom-scan.yml) only runs on a weekly schedule.
  • Installs OSV-Scanner pinned to v2.5.0 (a tagged release, not latest) via the official binary download URL.
  • Scans every real lockfile found in the repo: package-lock.json, frontend/package-lock.json, backend/package-lock.json, backend/pnpm-lock.yaml, Cargo.lock — covering npm, pnpm, and Cargo against the OSV/GHSA database, the same source Dependabot uses.
  • Fails the job (exit 1) if any vulnerability group's max_severity (CVSS base score) is >= 7.0 (High or Critical). Findings below that threshold are logged but don't fail the build, matching the acceptance criteria ("fails on high/critical").
  • Uploads full JSON results as a build artifact (osv-scan-results) so low/medium findings and full advisory detail are still reviewable.

.github/dependabot.yml (new, 77 lines)

  • npm ecosystem entries for / (root workspace), /frontend, /backend (covers both package-lock.json and pnpm-lock.yaml), and /sdk.
  • cargo ecosystem entry for / (workspace root, matches Cargo.toml).
  • github-actions ecosystem entry for / (keeps the CI supply chain itself patched).
  • All weekly (Monday), each with a groups: block bundling minor/patch updates into a single PR per ecosystem/directory to cut review noise; major bumps for the root workspace are excluded from auto-updates and left for manual review.
  • Labeled dependencies + ecosystem + security for easy triage/filtering.

docs/vulnerability-management.md (new, 84 lines)

  • Documents the two detection layers (OSV-Scanner PR gate, Dependabot) and how they relate to the existing weekly npm audit/cargo audit/Grype workflows.
  • Remediation SLA, mirroring the response targets already committed to in SECURITY.md:
    Severity | Acknowledge | Remediate by -- | -- | -- Critical | 24 hours | 7 days High | 48 hours | 14 days Medium | 1 week | 30 days Low | 2 weeks | Best effort
  • Step-by-step triage process (identify → confirm reachability → prefer upgrade → mitigate if no fix → dismiss false positives with a reason → verify).
  • Notes the grouped-PR strategy and the known Storybook/Next peer-dependency follow-up.

Acceptance criteria checklist

  • CI fails on High/Critical findings from OSV-Scanner across all lockfiles (.github/workflows/osv-scanner.yml, runs on every PR)
  • dependabot.yml defines grouped PRs and a documented SLA (grouping in the config itself; SLA table in docs/vulnerability-management.md, referenced from the config's header comment)
  • Stale lockfile drift resolved — frontend/package-lock.json now matches frontend/package.json (verified: no more EOVERRIDE, @finchippay/sdk now resolves)
  • Triage process documented (docs/vulnerability-management.md)

Dependency Security Bot added 2 commits August 17, 2026 21:48
- @finchippay/sdk was declared as a dependency ("*") but had no
  corresponding entry in package-lock.json at all, so npm ci silently
  skipped it and OSV-scanner/Dependabot could not resolve it against
  the GHSA/OSV database. Point it at file:../sdk (its real monorepo
  path) so it resolves and is captured in the lockfile.
- postcss was pinned via package.json#overrides (8.5.26) while the
  direct devDependency stayed at ^8. npm forbids overriding a direct
  dependency this way (EOVERRIDE), which meant npm ci was already
  broken on the default branch. Align the direct devDependency to
  8.5.26 to match the override and unblock installs.
- Regenerated package-lock.json (lockfileVersion 3) from the corrected
  package.json so the lockfile fully matches declared dependencies.
- .github/workflows/osv-scanner.yml (new, 88 lines): pinned OSV-Scanner
  v2.5.0 binary scans every real npm/pnpm/Cargo lockfile in the repo
  (package-lock.json, frontend/package-lock.json,
  backend/package-lock.json, backend/pnpm-lock.yaml, Cargo.lock) on
  every PR and push to main. Fails the build when any vulnerability
  group's max CVSS score is >=7.0 (High/Critical); results are
  uploaded as a build artifact for full detail.
- .github/dependabot.yml (new, 77 lines): weekly update PRs for npm
  (root, frontend, backend, sdk), cargo, and github-actions, grouped
  by minor/patch within each ecosystem to reduce PR noise.
- docs/vulnerability-management.md (new, 84 lines): documents the
  detection layers, remediation SLA (Critical 7d / High 14d /
  Medium 30d / Low best-effort, mirroring SECURITY.md's response
  targets), and the triage workflow for dependency alerts.
@github-actions github-actions Bot added the needs-review PR ready for Greptile AI code review label Aug 17, 2026
@github-actions

Copy link
Copy Markdown

🤖 Greptile AI Code Review

Greptile will automatically review this PR (5 file(s) changed).

Review gates:

  • ✅ CodeQL Security Scan
  • ✅ Custom rules (.greptile/config.json)
  • ✅ Architecture guidelines (.greptile/rules.md)

To manually trigger a re-review, comment @greptileai on this PR.
To skip review, add the skip-review label.

@Topmatrixmor2014

Copy link
Copy Markdown
Contributor

Please fix this failing CI

… severity gate

Real CI run (PR FinChippay#671) surfaced two things:

1. The severity gate in osv-scanner.yml was checking a JSON field
   (.groups[].max_severity) that does not exist in the OSV schema -
   severity lives under .vulnerabilities[].severity[].score as a raw
   CVSS vector string, which jq cannot parse into a number. Replaced
   it with osv-scanner's own pre-computed summary line ("X Critical,
   Y High, ..."), verified against all four real scan outputs from
   this PR (2 High / 8 High / 0 High-1 Unknown / clean).

2. Real High/Critical findings, triaged per docs/vulnerability-management.md:
   - backend/pnpm-lock.yaml: 8 High findings (brace-expansion, fast-uri,
     js-yaml, all transitive) - fixed via pnpm.overrides in
     backend/package.json pinning each to its patched release.
   - package-lock.json + frontend/package-lock.json: 2 High findings
     for image-size@2.0.2 (transitive devDependency of
     vite-plugin-storybook-nextjs only, never runs against production
     input; upstream archived, no fix available) - documented and
     suppressed via osv-scanner.toml IgnoredVulns, expiring 2026-11-15
     for re-review, rather than adopting an unverified third-party fork.
   - Cargo.lock: 1 Unknown-severity finding, below the gate threshold,
     no action needed to unblock this PR.
@Theophilus131

Copy link
Copy Markdown
Author

i have fixed the ci work flow.

@Topmatrixmor2014
Topmatrixmor2014 merged commit 6efbcbd into FinChippay:main Aug 21, 2026
18 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-review PR ready for Greptile AI code review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Issue #77 — Dependency Vulnerability Policy: OSV-Scanner in CI + Dependabot SLAs

2 participants